package com.changgou.controller;

import com.changgou.entity.Result;
import com.changgou.entity.StatusCode;

import com.changgou.service.ESManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/manager")
public class ESManagerController {

    @Autowired
    private ESManagerService esManagerService;

    @RequestMapping("/create")
    private Result create() {
        esManagerService.createIndexAndMapping();
        return new Result(true, StatusCode.OK, "索引数据库创建成功");
    }

    @RequestMapping("/importAll")
    public Result importAll() {
        esManagerService.importAll();
        return new Result(true, StatusCode.OK, "索引库导入全部数据成功");
    }
}
